import {BasicColumn, FormSchema} from '@apps/antd-admin/src/components/Table';
import {render} from "@apps/antd-admin/src/hooks/render/renderUtils";
import {Api} from './brand.api';

export const columns: BasicColumn[] = [
  {
    title: '品牌名称',
    dataIndex: 'brandName',
    width: 100,
  },
  {
    title: '品牌logo',
    dataIndex: 'brandLogo',
    width: 50,
    customRender: render.renderImage,
  },
  {
    title: '启用',
    dataIndex: 'status',
    width: 30,
    sorter:true,
    renderApi: Api.setState,
    rowKey: 'brandId',
    fixed: 'right',
    customRender: render.renderSwitch
  },
  {
    title: '推荐',
    dataIndex: 'hot',
    width: 30,
    sorter:true,
    renderApi: Api.setHot,
    rowKey: 'brandId',
    fixed: 'right',
    customRender: render.renderSwitch
  },
  {
    title: '首字母',
    dataIndex: 'firstLetter',
    width: 50,
  }
];

export const searchFormSchema: FormSchema[] = [
  {
    field: 'brandName',
    label: '品牌名称',
    component: 'Input',
    colProps: {span: 3},
  }
];

export const formSchema: FormSchema[] = [
  {
    label: '品牌名称',
    field: 'brandName',
    component: 'Input',
    required: true,
  },
  {
    label: '品牌logo',
    field: 'brandLogo',
    component: 'ImageUpload',
    required: true,
  },
  {
    label: '热门品牌',
    field: 'hot',
    component: 'Switch',
    componentProps: {
      checkedValue: 1,
      unCheckedValue: 0
    }
  }
];
